package com.punch.order.constants;

/**
 * 支付渠道定义
 */
public enum PayChannelEnum {

    /**
     * 0元订单无支付
     */
    ZERO("ZERO", "无"),
    /**
     * 支付宝app
     */
    ALIPAY_APP("ALIPAY_APP", "支付宝"),
    /**
     * 微信app
     */
    WXPAY_APP("WXPAY_APP", "微信"),
    ;


    private String code;
    private String name;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    PayChannelEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getName(String code) {
        if (code == null) {
            return "";
        }
        for (PayChannelEnum payChannelEnum : PayChannelEnum.values()) {
            if (payChannelEnum.getCode().equals(code) ) {
                return payChannelEnum.getName();
            }
        }
        return "";
    }
}
